﻿using System;
using System.Collections.Generic;
using System.Linq;
using SDF.Core.Caching;
using SDF.Core;

namespace SDFAuth.Services{

    public abstract class BaseService
    {
        public ICacheManager CacheManager { get; set; }


        //public PagedList<TDto> GetPagedList<TEntity,TDto>(IQueryable<TEntity> q,Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> order                                                         
        //                                                ,int pgIndex, int pgSize
        //    ) where TEntity: class
        //{
        //    var pagedList = GetPagedList(q, order ,pgIndex, pgSize);
        //    var dtoList = Mapper.Map<List<TEntity>, List<TDto>>(pagedList.List);
        //    var dtoPagedList = PagedList<TDto>.GetPagedList(dtoList, pagedList.Count);
        //    return dtoPagedList;
        //}

        //public PagedList<TEntity> GetPagedList<TEntity>(IQueryable<TEntity> q, Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> order
        //                                                , int pgIndex, int pgSize
        //    ) where TEntity : class
        //{
        //    int count;
        //    var list = q.Paged<TEntity>(pgIndex, pgSize, order, out  count).ToList();
        //    var pagedList = PagedList<TEntity>.GetPagedList(list, count);
        //    return pagedList;
        //}

        //public PagedList<TDto> GetPagedList<TEntity, TDto>(IQueryable<TEntity> q,
        //                                                Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> order,
        //                                                int pgIndex, int pgSize
        //    ) where TEntity : class
        //{
        //    int count;
        //    var list = q.Paged<TEntity>(pgIndex, pgSize, order, out  count).ToList();
        //    var pagedList = PagedList<TEntity>.GetPagedList(list, count);
        //    var dtoList = Mapper.Map<List<TEntity>, List<TDto>>(pagedList.List);
        //    var dtoPagedList = PagedList<TDto>.GetPagedList(dtoList, pagedList.Count);
        //    return dtoPagedList;
        //}
    }

}
